function changeUrl(text) {
  const httpPattern = new RegExp("(https?)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]", "g");
  return text.replace(httpPattern, "https://www.lagou.com");
}

const text = "用户输入xxxhttps://www.baidu.com用户输入yyyhttps://qq.com用户输入zzz";

console.log(changeUrl(text));
